﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace AnesSystem.Controls.CommonTables.SC.DCYY
{
    /// <summary>
    /// HuLiJiLuCtrl.xaml 的交互逻辑
    /// </summary>
    public partial class ShouShuHuLiJiLuCtrl : CustomCommonTableCtrl
    {
        public ShouShuHuLiJiLuCtrl()
        {
            InitializeComponent();
            if (DataManager.Instance.CurrentPatientLink != null)
            {
                sssj.Text = DataManager.Instance.CurrentPatientLink.Status.InRoomTime.Equals(new DateTime()) ? "" : DataManager.Instance.CurrentPatientLink.Status.InRoomTime.ToString(DateFormat.DATE_FORMAT_STR_YMD_CN);
                ssrssj.Text = DataManager.Instance.CurrentPatientLink.Status.InRoomTime.Equals(new DateTime()) ? "" : DataManager.Instance.CurrentPatientLink.Status.InRoomTime.ToString(DateFormat.DATE_FORMAT_STR_YMDHM);
                sskssj.Text = DataManager.Instance.CurrentPatientLink.Status.OperStartTime.Equals(new DateTime()) ? "" : DataManager.Instance.CurrentPatientLink.Status.OperStartTime.ToString(DateFormat.DATE_FORMAT_STR_YMDHM);
                ssjssj.Text = DataManager.Instance.CurrentPatientLink.Status.OperEndTime.Equals(new DateTime()) ? "" : DataManager.Instance.CurrentPatientLink.Status.OperEndTime.ToString(DateFormat.DATE_FORMAT_STR_YMDHM);
                sscssj.Text = DataManager.Instance.CurrentPatientLink.Status.OutRoomTime.Equals(new DateTime()) ? "" : DataManager.Instance.CurrentPatientLink.Status.OutRoomTime.ToString(DateFormat.DATE_FORMAT_STR_YMDHM);
            }
            IniteRadioBation();
        }
        private void IniteRadioBation()
        {
            new RadioButtonHelper().ChangeRadioSatus(zq, jz); new RadioButtonHelper().ChangeRadioSatus(jshzt_jiah, jshzt_ch, jshzt_dm, jshzt_zhai);
            new RadioButtonHelper().ChangeRadioSatus(yy_qc, yy_bqc); new RadioButtonHelper().ChangeRadioSatus(yw_w, yw_y);
            new RadioButtonHelper().ChangeRadioSatus(xil_pj, xil_jz, xil_jl, xil_kj); new RadioButtonHelper().ChangeRadioSatus(shshs_w, shshs_y);
            new RadioButtonHelper().ChangeRadioSatus(zht_w, zht_y); new RadioButtonHelper().ChangeRadioSatus(pf_wh, pf_yc);
            new RadioButtonHelper().ChangeRadioSatus(JCB26, JCB27); new RadioButtonHelper().ChangeRadioSatus(bbgl_wh, bbgl_yh);
            new RadioButtonHelper().ChangeRadioSatus(bbgl_w, bbgl_y); new RadioButtonHelper().ChangeRadioSatus(szsy_w, szsy_y);
            new RadioButtonHelper().ChangeRadioSatus(blbb_w, blbb_y); new RadioButtonHelper().ChangeRadioSatus(qx_whh, qx_ycc, qx_fh, qx_ts);
            new RadioButtonHelper().ChangeRadioSatus(gfx_w, gfx_y); new RadioButtonHelper().ChangeRadioSatus(shb_w, shb_y);
            new RadioButtonHelper().ChangeRadioSatus(JCB8, JCB9); new RadioButtonHelper().ChangeRadioSatus(JCB23, JCB21);
            new RadioButtonHelper().ChangeRadioSatus(qjw, qjy); new RadioButtonHelper().ChangeRadioSatus(dggl_w, dggl_y);
            new RadioButtonHelper().ChangeRadioSatus(shzsx_w, shzsx_y); new RadioButtonHelper().ChangeRadioSatus(qx_whh, qx_ycc, qx_ts, qx_fh);
            

        }
        private void sssj_GotFocus(object sender, RoutedEventArgs e)
        {
            CustomTextCtrl cuText = sender as CustomTextCtrl;
            CusDatePickerWin cusDatePicker = new CusDatePickerWin();
            cusDatePicker.SelectedDateTime = DateTime.Now;

            cusDatePicker.ShowDialog();

            if (cusDatePicker.Result)
            {
                cuText.Value = cusDatePicker.SelectedDateTime;//2005年11月5日
            }
        }
        private void sj_GotFocus(object sender, RoutedEventArgs e)
        {
            CustomTextCtrl cuText = sender as CustomTextCtrl;
            CusDatePickerWin cusDatePicker = new CusDatePickerWin();
            cusDatePicker.SelectedDateTime = DateTime.Now;

            cusDatePicker.ShowDialog();

            if (cusDatePicker.Result)
            {
                cuText.Value = cusDatePicker.SelectedDateTime.ToString(DateFormat.DATE_FORMAT_STR_YMD_CN);//2005年11月5日
            }
        }
    }
}
